\(\int \coth (c+d x) (a+b \tanh ^2(c+d x)) \, dx\) [139]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 25 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {b \log (\cosh (c+d x))}{d}+\frac {a \log (\sinh (c+d x))}{d} \]

[Out]

b*ln(cosh(d*x+c))/d+a*ln(sinh(d*x+c))/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3706, 3556} \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {a \log (\sinh (c+d x))}{d}+\frac {b \log (\cosh (c+d x))}{d} \]

[In]

Int[Coth[c + d*x]*(a + b*Tanh[c + d*x]^2),x]

[Out]

(b*Log[Cosh[c + d*x]])/d + (a*Log[Sinh[c + d*x]])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3706

Int[((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Dist[A, Int[1/Tan[e + f*x],
 x], x] + Dist[C, Int[Tan[e + f*x], x], x] /; FreeQ[{e, f, A, C}, x] && NeQ[A, C]

Rubi steps \begin{align*} \text {integral}& = a \int \coth (c+d x) \, dx+b \int \tanh (c+d x) \, dx \\ & = \frac {b \log (\cosh (c+d x))}{d}+\frac {a \log (\sinh (c+d x))}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.32 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {b \log (\cosh (c+d x))}{d}+\frac {a (\log (\cosh (c+d x))+\log (\tanh (c+d x)))}{d} \]

[In]

Integrate[Coth[c + d*x]*(a + b*Tanh[c + d*x]^2),x]

[Out]

(b*Log[Cosh[c + d*x]])/d + (a*(Log[Cosh[c + d*x]] + Log[Tanh[c + d*x]]))/d

Maple [A] (verified)

Time = 0.23 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.96

method result size
derivativedivides \(\frac {a \ln \left (\sinh \left (d x +c \right )\right )+b \ln \left (\cosh \left (d x +c \right )\right )}{d}\) \(24\)
default \(\frac {a \ln \left (\sinh \left (d x +c \right )\right )+b \ln \left (\cosh \left (d x +c \right )\right )}{d}\) \(24\)
parallelrisch \(\frac {\left (-a -b \right ) \ln \left (1-\tanh \left (d x +c \right )\right )+a \ln \left (\tanh \left (d x +c \right )\right )-\left (a +b \right ) x d}{d}\) \(41\)
risch \(-a x -b x -\frac {2 b c}{d}-\frac {2 a c}{d}+\frac {\ln \left ({\mathrm e}^{2 d x +2 c}+1\right ) b}{d}+\frac {a \ln \left ({\mathrm e}^{2 d x +2 c}-1\right )}{d}\) \(58\)

[In]

int(coth(d*x+c)*(a+b*tanh(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*ln(sinh(d*x+c))+b*ln(cosh(d*x+c)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (25) = 50\).

Time = 0.26 (sec) , antiderivative size = 70, normalized size of antiderivative = 2.80 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {{\left (a + b\right )} d x - b \log \left (\frac {2 \, \cosh \left (d x + c\right )}{\cosh \left (d x + c\right ) - \sinh \left (d x + c\right )}\right ) - a \log \left (\frac {2 \, \sinh \left (d x + c\right )}{\cosh \left (d x + c\right ) - \sinh \left (d x + c\right )}\right )}{d} \]

[In]

integrate(coth(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="fricas")

[Out]

-((a + b)*d*x - b*log(2*cosh(d*x + c)/(cosh(d*x + c) - sinh(d*x + c))) - a*log(2*sinh(d*x + c)/(cosh(d*x + c)
- sinh(d*x + c))))/d

Sympy [F]

\[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\int \left (a + b \tanh ^{2}{\left (c + d x \right )}\right ) \coth {\left (c + d x \right )}\, dx \]

[In]

integrate(coth(d*x+c)*(a+b*tanh(d*x+c)**2),x)

[Out]

Integral((a + b*tanh(c + d*x)**2)*coth(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.40 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {b \log \left (e^{\left (d x + c\right )} + e^{\left (-d x - c\right )}\right )}{d} + \frac {a \log \left (\sinh \left (d x + c\right )\right )}{d} \]

[In]

integrate(coth(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="maxima")

[Out]

b*log(e^(d*x + c) + e^(-d*x - c))/d + a*log(sinh(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.84 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=-\frac {{\left (d x + c\right )} {\left (a + b\right )} - b \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) - a \log \left ({\left | e^{\left (2 \, d x + 2 \, c\right )} - 1 \right |}\right )}{d} \]

[In]

integrate(coth(d*x+c)*(a+b*tanh(d*x+c)^2),x, algorithm="giac")

[Out]

-((d*x + c)*(a + b) - b*log(e^(2*d*x + 2*c) + 1) - a*log(abs(e^(2*d*x + 2*c) - 1)))/d

Mupad [B] (verification not implemented)

Time = 1.85 (sec) , antiderivative size = 228, normalized size of antiderivative = 9.12 \[ \int \coth (c+d x) \left (a+b \tanh ^2(c+d x)\right ) \, dx=\frac {a\,\ln \left (8\,a\,b-4\,a^2-4\,b^2+4\,a^2\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}+4\,b^2\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}-8\,a\,b\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}\right )}{2\,d}-b\,x-\frac {\mathrm {atan}\left (\frac {a\,{\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}\,\sqrt {-d^2}}{d\,\sqrt {a^2-2\,a\,b+b^2}}-\frac {b\,{\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}\,\sqrt {-d^2}}{d\,\sqrt {a^2-2\,a\,b+b^2}}\right )\,\sqrt {a^2-2\,a\,b+b^2}}{\sqrt {-d^2}}-a\,x+\frac {b\,\ln \left (8\,a\,b-4\,a^2-4\,b^2+4\,a^2\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}+4\,b^2\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}-8\,a\,b\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}\right )}{2\,d} \]

[In]

int(coth(c + d*x)*(a + b*tanh(c + d*x)^2),x)

[Out]

(a*log(8*a*b - 4*a^2 - 4*b^2 + 4*a^2*exp(4*c)*exp(4*d*x) + 4*b^2*exp(4*c)*exp(4*d*x) - 8*a*b*exp(4*c)*exp(4*d*
x)))/(2*d) - b*x - (atan((a*exp(2*c)*exp(2*d*x)*(-d^2)^(1/2))/(d*(a^2 - 2*a*b + b^2)^(1/2)) - (b*exp(2*c)*exp(
2*d*x)*(-d^2)^(1/2))/(d*(a^2 - 2*a*b + b^2)^(1/2)))*(a^2 - 2*a*b + b^2)^(1/2))/(-d^2)^(1/2) - a*x + (b*log(8*a
*b - 4*a^2 - 4*b^2 + 4*a^2*exp(4*c)*exp(4*d*x) + 4*b^2*exp(4*c)*exp(4*d*x) - 8*a*b*exp(4*c)*exp(4*d*x)))/(2*d)